/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package xq.gwt.mvc.view;

import java.util.ArrayList;

/**
 *
 * @author admin
 */
public class ObservableViewImp implements ObservableView{
    protected  ArrayList<ViewChangedListener> listeners = new ArrayList<ViewChangedListener>();

    public void addViewChangedListener(ViewChangedListener listener) {
        if(listener == null)
			return;
		listeners.add(listener);
    }

    public void removeViewChangedListener(ViewChangedListener listener) {
        listeners.remove(listener);
    }

    protected void notifyViewChangedListeners(){        
    	for (int i = 0; i < listeners.size(); i++) {
    		ViewChangedListener listener = listeners.get(i);
    		if(listener != null){
    			listener.viewChanged();
    		}
            
        }
    }

}
